package com.fjnldx.mes.controller.energyRecord;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjnldx.mes.domain.domainReq.PowerConsumptionOfMachineReq;
import com.fjnldx.mes.domain.domainReq.VarietyPowerConsumptionReq;
import com.fjnldx.mes.domain.domainRes.Result;
import com.fjnldx.mes.service.energyRecord.EnergyRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/historicalData/energy")
@Api(value = "能源记录", tags = "能源记录")
public class EnergyRecordController {

    @Resource
    private EnergyRecordService energyRecordService;

    @GetMapping("/varietyPowerConsumption")
    @ApiOperation(value = "品种电耗（品种维度汇总）", notes = "Api")
    public Result varietyPowerConsumption(VarietyPowerConsumptionReq varietyPowerConsumptionReq, Page page){
        return energyRecordService.varietyPowerConsumption(varietyPowerConsumptionReq, page);
    }

    @GetMapping("/powerConsumptionOfMachine")
    @ApiOperation(value = "各机台电耗-表格(明细)", notes = "Api")
    public Result powerConsumptionOfMachine(PowerConsumptionOfMachineReq powerConsumptionOfMachineReq, Page page){
        return energyRecordService.powerConsumptionOfMachine(powerConsumptionOfMachineReq, page);
    }

    @GetMapping("/consumptionOfGongxu")
    @ApiOperation(value = "工序电耗（工序维度汇总）", notes = "Api")
    public Result consumptionOfGongxu(VarietyPowerConsumptionReq varietyPowerConsumptionReq, Page page){
        return energyRecordService.consumptionOfGongxu(varietyPowerConsumptionReq, page);
    }

    @GetMapping("/lineChart")
    @ApiOperation(value = "电流折线图-表格（明细）", notes = "Api")
    public Result lineChart(PowerConsumptionOfMachineReq powerConsumptionOfMachineReq, Page page){
        return energyRecordService.lineChart(powerConsumptionOfMachineReq, page);
    }
}
